﻿using FluentMigrator.Builders.Create.Table;

namespace Budget.DataBase
{
    static class MigrationExpensions
    {
        public static ICreateTableColumnOptionOrWithColumnSyntax WithKeyColumn(this ICreateTableWithColumnSyntax tableWithColumnSyntax)
        {
            return tableWithColumnSyntax
                .WithColumn("Id")
                .AsInt32()
                .NotNullable()
                .PrimaryKey()
                .Identity();
        }

        public static ICreateTableColumnOptionOrWithColumnSyntax WithTimeStamps(this ICreateTableWithColumnSyntax tableWithColumnSyntax)
        {
            return tableWithColumnSyntax
                .WithColumn("CreationDate").AsDateTime().NotNullable().WithDefaultValue("getdate()");
        }
    }
}